var vm = new Vue({
	el: '#app',
	data: function() {
		return {
			searchOperationLog: {},
			page: {
				index: 1,
				total: 0,
				currentPage: 1,
				pageSize: 10,
			},
			operationLogs: []
		};
	},
	methods: {
		/**
		 * 查询该页数的数据
		 * 
		 * @param val 当前页数
		 */
		search: function(val) {
			var _this = this;
			authAxios({
				method: 'get',
				url: CONST_URL + '/operationLog/findAll',
				params: {
					page: val - 1,
					size: _this.page.pageSize
				}
			}).then(function(response) {
				if(response.data.code == '0000') {
					var pageOperationLog = response.data.data;
					_this.page.index = (val - 1) * _this.page.pageSize + 1;
					_this.operationLogs = pageOperationLog.content;
					_this.page.total = pageOperationLog.totalElements;
				} else {
					_this.$message.error('加载数据失败！');
					console.log(response.data);
				}
			}).catch(function(error) {
				alert(error.response.status);
				console.log(error);
			});
		}
	},
	mounted: function() {
		this.$nextTick(function() {
			var _this = this;
			checkToken().then(function() {
				var token = localStorage.getItem('token');
				if(token != null) {
					token = JSON.parse(token);
					authAxios.defaults.headers.common['Authorization'] = token.token_type + ' ' + token.access_token;
				}
			}).then(function() {
				_this.search(1);
			});
		});
	}
});